/**
 * VUEshop
 * ============================================================================
 * * 版权所有 2015-2027 深圳搜豹网络科技有限公司，并保留所有权利。
 * 网站地址: http://www.vueshop.com.cn
 * ----------------------------------------------------------------------------
 * 这不是一个自由软件！您只能在不用于商业目的的前提下对程序代码进行修改和使用 .
 * 不允许对程序代码以任何形式任何目的的再发布。
 * ============================================================================
 * $Author: soubao-java 2020-07-22 $
 */<template>
  <div>
    <div>
      <div class="fixed-bar">
        <div class="item-title">
          <router-link class="back" :to="{name:'complain_subject'}" title="返回列表">
            <i class="fa fa-arrow-circle-o-left"></i>
          </router-link>
          <div class="subject">
            <h3>投诉管理 - 新增</h3>
            <h5>商城对商品交易投诉管理及仲裁</h5>
          </div>
        </div>
      </div>
      <form :model="form">
        <div class="ncap-form-default">
          <dl class="row">
            <dt class="tit">
              <label>
                <em>*</em>投诉主题
              </label>
            </dt>
            <dd class="opt">
              <input v-model="form.subject_name" type="text" class="input-txt" />
              <p
                class="err-msg"
                v-if="errResult.subject_name && !form.subject_name"
              >{{errResult.subject_name}}</p>
            </dd>
          </dl>
          <dl class="row">
            <dt class="tit">
              <label>
                <em>*</em>投诉主题描述
              </label>
            </dt>
            <dd class="opt">
              <textarea v-model="form.subject_desc" rows="6" class="tarea"></textarea>
              <p
                class="err-msg"
                v-if="errResult.subject_desc && !form.subject_desc"
              >{{errResult.subject_desc}}</p>
            </dd>
          </dl>
          <div class="bot">
            <a @click="onSubmit()" class="ncap-btn-big ncap-btn-green">确认提交</a>
          </div>
        </div>
      </form>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      form: {},
      isLoading: false,
      errResult: {}
    };
  },
  methods: {
    onSubmit() {
      this.isLoading = true;
      var that = this;
      this.request
        .post("/order/complain_subject", that.form)
        .then(function(res) {
          if (res.status == 1) {
            that.$message.success({
              message: "添加成功",
              duration: 1000,
              onClose: function() {
                that.$router.push({ name: "complain_subject" });
              }
            });
          } else if (res.status == -1) {
            that.$message.error("参数错误");
            that.errResult = res.result;
          } else {
            that.$message.error("保存失败");
          }
          that.isLoading = false;
        });
    }
  }
};
</script>

<style scoped>
</style>
